package com.androinject.android.factory.input;

import java.io.InputStream;

import android.content.Context;

import com.androinject.core.factory.input.InputSource;

public class AndroidInputSource implements InputSource {
	
	private Context context;
	private InputStream inputStream;
	private int resId;
	
	
	public AndroidInputSource(Context context, int resId) {
		this.context = context;
		this.resId = resId;
	}

	public InputStream getInputStream() {
		this.inputStream = this.context.getResources().openRawResource(this.resId);
		return this.inputStream;
	}

	public void close() {
		try {
			this.inputStream.close();
		} catch (Exception e) { }
	}

}
